import HTTPREQUEST from './http';

export const getResultData_servers = (postData) => {
  return HTTPREQUEST.post('/api/white-screen/search', postData);
};

// 获取验证码
export const getCodeApi = (phone) => {
  return HTTPREQUEST.get(`/common/code?mobile=${phone}`);
};

// 上传资源
export const uploadResourceApi = (postData) => {
  return HTTPREQUEST.post('/common/image', postData);
};

// 个人注册
export const registerApi = (postData) => {
  return HTTPREQUEST.post(
    '/program/per-reg',
    postData,
    'application/x-www-form-urlencoded',
  );
};

// 门店注册
export const storeRegisterApi = (postData) => {
  return HTTPREQUEST.post(
    '/program/store-reg',
    postData,
    'application/x-www-form-urlencoded',
  );
};

/* 登录 */
export const loginApi = (postData) => {
  return HTTPREQUEST.post(
    '/program/login',
    postData,
    'application/x-www-form-urlencoded',
  );
};

// 个人中心
export const getUserInfoApi = () => {
  return HTTPREQUEST.get('/program/detail');
};

/* 修改密码 */
export const changePasswordApi = (postData) => {
  return HTTPREQUEST.put(
    '/program/password',
    postData,
    'application/x-www-form-urlencoded',
  );
};

/* 修改个人资料 */
export const changeUserInfoApi = (postData) => {
  return HTTPREQUEST.put(
    '/program/detail',
    postData,
    'application/x-www-form-urlencoded',
  );
};

// 提现管理
export const getWithdrawApi = () => {
  return HTTPREQUEST.get('/battery/revenue');
};

// 用户信息查询
export const userCheckApi = (postData) => {
  return HTTPREQUEST.post(
    '/battery/user-check',
    postData,
    'application/x-www-form-urlencoded',
  );
};

// 用户渠道绑定
export const userBindingApi = (postData) => {
  return HTTPREQUEST.post(
    '/battery/user-bind',
    postData,
    'application/x-www-form-urlencoded',
  );
};

// 最后一条公告
export const getLastNoticeApi = () => {
  return HTTPREQUEST.get('/board/last');
};

// 公告列表
export const getNoticeListApi = () => {
  return HTTPREQUEST.get('/board/list');
};

// 优惠券配置
export const getCouponConfigApi = () => {
  return HTTPREQUEST.get('/battery/coupon-list');
};

// 绑定优惠券
export const bindCouponApi = (postData) => {
  return HTTPREQUEST.post(
    '/battery/user-coupon',
    postData,
    'application/x-www-form-urlencoded',
  );
};

export const getKickbackApi = () => {
  return HTTPREQUEST.get('/battery/kickback');
};

// 在租用户数
export const getRentUserApi = () => {
  return HTTPREQUEST.get('/battery/develop');
};

// 发展用户数
export const getDevelopUserApi = (data) => {
  return HTTPREQUEST.get('/battery/develop', data);
};

// 逾期用户数
export const getOverdueUserApi = () => {
  return HTTPREQUEST.get('/battery/overdue');
};

// 换电数据-发展用户
export const getDevelopUserDataApi = (data) => {
  // return HTTPREQUEST.get("/battery/develop-user", data);
  // return HTTPREQUEST.get("/battery/develop-list", data);
  return HTTPREQUEST.get('/battery/mini-develop', data);
};

// 在租用户
export const getRentingUserApi = (data) => {
  return HTTPREQUEST.get('/battery/mini-renting', data);
  // return HTTPREQUEST.get("/battery/renting-user", data);
};

// 换电数据 - 逾期用户
export const getOverdueUserListApi = (data) => {
  return HTTPREQUEST.get('/battery/mini-overdue', data);
  // return HTTPREQUEST.get("/battery/overdue-user", data);
};

// 提现
export const withDrawalApi = (data) => {
  return HTTPREQUEST.post('/battery/withdrawal', data);
};

/* 获取权限列表 */
export const getPermissionListApi = () => {
  return HTTPREQUEST.get('/authority/permission');
};

/* 获取定位 */
export const getLocationApi = (data) => {
  return HTTPREQUEST.get('/battery/mini-look', data);
};

// 消除逾期天数
export const clearOverdueApi = (data) => {
  return HTTPREQUEST.post('/battery/eliminate', data);
};

// 转换为个人
export const convertToPersonalApi = (data) => {
  return HTTPREQUEST.post('/battery/convert-individuals', data);
};

// 搜索电池
export const searchBatteryApi = (data) => {
  return HTTPREQUEST.post('/battery/query-batteries', data);
};

// 查询电池状态
export const queryBatteryStatusApi = (data) => {
  return HTTPREQUEST.get('/battery/batteryinfo?id=' + data?.id);
};

// 获取平台配置
export const getPlatformConfigApi = () => {
  return HTTPREQUEST.get('/user/config/1');
};

// 绑定电池
export const bindBatteryApi = (data) => {
  return HTTPREQUEST.post('/battery/binding-batteries', data);
};

// 解绑电池
export const unbindBatteryApi = (data) => {
  return HTTPREQUEST.post('/battery/unbind-batteries', data);
};
/* batteries: info?.binding_batteries, */

// 获取商户可绑定类型
export const getMerchantTypeApi = () => {
  return HTTPREQUEST.get('/battery/bind-type');
};

//
export const getBingLog = (data) => {
  return HTTPREQUEST.get('/journal/mini-log-bind', data);
};

// 用户校验日志
export const getUserCheckLog = (data) => {
  return HTTPREQUEST.get('/journal/mini-check-log', data);
};

// 优惠券日志
export const getCouponLog = (data) => {
  return HTTPREQUEST.get('/journal/mini-coupons-log', data);
};

// 电池查询日志
export const getUserDianchiLog = (data) => {
  return HTTPREQUEST.get('/journal/mini-log-battery', data);
};

// 查询日志
export const getCommonLog = (data) => {
  return HTTPREQUEST.get('/journal/mini-log-all', data);
};

// 换电柜管理
export const getDianchiList = (data) => {
  return HTTPREQUEST.get(`/battery/cabinetinfo?id=${data?.id}`, {}, true);
};

// 查询换电柜详情
export const getDianchiDetailApi = (data) => {
  return HTTPREQUEST.get(`/battery/listCabinetDoor`, data);
};

// 开门
export const openDoorApi = (data) => {
  return HTTPREQUEST.post(`/battery/cabinetinfo`, data);
};
